import request from '@/utils/request'

// 查询题目列表
export function listQuestion(query) {
  return request({
    url: '/exam/question/list',
    method: 'get',
    params: query
  })
}

// 查询题目所有列表
export function listAllQuestion(query) {
  return request({
    url: '/exam/question/listAll',
    method: 'get',
    params: query
  })
}

// 导出题目列表
export function exportQuestion(query) {
  return request({
    url: '/exam/question/export',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}

// 查询题目详细
export function getQuestion(questionId) {
  return request({
    url: '/exam/question/getInfo/' + questionId,
    method: 'get'
  })
}

// 获取题目详细信息（包含选项、答案、解析等）
export function getQuestionDetail(questionId) {
  return request({
    url: '/exam/question/getDetailInfo/' + questionId,
    method: 'get'
  })
}

// 新增题目
export function addQuestion(data) {
  return request({
    url: '/exam/question/add',
    method: 'post',
    data: data
  })
}

// 修改题目
export function updateQuestion(data) {
  return request({
    url: '/exam/question/edit',
    method: 'post',
    data: data
  })
}

// 删除题目
export function delQuestion(questionIds) {
  return request({
    url: '/exam/question/remove/' + questionIds,
    method: 'get'
  })
}

// 提交答案
export function submitAnswer(data) {
  return request({
    url: '/exam/question/submitAnswer',
    method: 'post',
    data: data
  })
}

// 获取用户当前题库的当前题目的答题记录信息
export function getBankQuestionRecord(questionId, bankId) {
  return request({
    url: '/exam/question/getBankQuestionRecord',
    method: 'get',
    params: {
      questionId: questionId,
      bankId: bankId
    }
  })
}
